﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Robotics.Race
{
	[Serializable]
	abstract public class Controller
	{
		private string name;
		[System.ComponentModel.Category("Name")]
		public string Name { get { return name; } set { name = value; } }
		abstract public void Drive( SensedEnvironment environment, ControlGear gear );

		public override string ToString()
		{
			if ( Name != null )
				return Name;
			else
				return "[none]";
		}

		[System.ComponentModel.Browsable( false )]
		public string TypeName
		{
			get
			{
				object[] typeName = GetType().GetCustomAttributes( typeof( ShortNameAttribute ), false );
				if ( typeName != null && typeName.Length > 0 )
					return (typeName[0] as ShortNameAttribute ).ShortName;
				else
					return GetType().Name;
			}
		}

		[System.ComponentModel.Browsable(false)]
		public string FullName
		{
			get
			{
				return TypeName + "." + Name;
			}
		}
	}
}
